<?php

namespace App\Modules\Company\Vo;

use Hyperf\Contract\LengthAwarePaginatorInterface;

class CompanyIndexVO
{
    /**
     * @var LengthAwarePaginatorInterface
     */
    private $paginator;

    /**
     * @var array
     */
    private $data;

    public function __construct(LengthAwarePaginatorInterface $paginator, array $data)
    {
        $this->paginator = $paginator;
        $this->data = $data;
    }

    public function toArray()
    {
        return [
            'total' => $this->paginator->total(),
            'per_page' => $this->paginator->perPage(),
            'current_page' => $this->paginator->currentPage(),
            'total_pages' => $this->paginator->lastPage(),
            'data' => $this->data,
        ];
    }
}